-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Clone Apify (API Key) components to Apify (OAuth) #18196
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 2 Skipped Deployments
|
WalkthroughAdds OAuth-wrapped variants for multiple Apify actions and sources, a shared prop-adjustment utility, updates the Apify OAuth app with shared propDefinitions and a _headers() method using oauth_access_token, and bumps the apify_oauth package version and dependency. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant Wrapper as OAuth Wrapper (action/source)
participant App as Apify OAuth App
participant API as Apify API
User->>Wrapper: invoke action/source with inputs
Wrapper->>App: request headers via _headers()
Note right of App #DDEEFF: reads this.$auth.oauth_access_token
App-->>Wrapper: headers { Authorization: Bearer ... , x-apify-integration-platform: "pipedream" }
Wrapper->>API: HTTP request with OAuth headers
API-->>Wrapper: response (data / status)
Wrapper-->>User: return result / emit event
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Assessment against linked issues
Assessment against linked issues: Out-of-scope changes
Poem
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. 📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 💡 Knowledge Base configuration:
You can enable these sources in your CodeRabbit configuration. ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
✨ Finishing Touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
♻️ Duplicate comments (4)
components/apify_oauth/actions/set-key-value-store-record/set-key-value-store-record.mjs (1)
1-22: DRY via shared wrapper helper (see earlier comment)This file can also use the proposed wrap() helper to cut repetition.
components/apify_oauth/actions/run-task-synchronously/run-task-synchronously.mjs (1)
1-22: Apply the shared wrap() helper to reduce boilerplateSame refactor opportunity as other wrappers.
components/apify_oauth/sources/new-finished-actor-run-instant/new-finished-actor-run-instant.mjs (1)
1-22: Use the common wrap() helperSame optional refactor to minimize duplication.
components/apify_oauth/actions/scrape-single-url/scrape-single-url.mjs (1)
1-22: Consider the shared wrap() helper here as wellKeeps all OAuth wrappers consistent and concise.
🧹 Nitpick comments (5)
components/apify_oauth/common/utils.mjs (1)
1-1: Guard against undefined props (minor).
Default props to {} to avoid crashes if a caller passes undefined.-export function adjustPropDefinitions(props, app) { +export function adjustPropDefinitions(props = {}, app) {components/apify_oauth/apify_oauth.app.mjs (1)
11-16: Fail fast if the OAuth access token is missing.
Prevents confusing 401s downstream._headers() { - return { + const token = this.$auth?.oauth_access_token; + if (!token) { + throw new Error("Missing OAuth access token (apify_oauth connection)."); + } + return { "Content-Type": "application/json", - "Authorization": `Bearer ${this.$auth.oauth_access_token}`, + "Authorization": `Bearer ${token}`, "x-apify-integration-platform": "pipedream", }; },components/apify_oauth/actions/run-actor/run-actor.mjs (1)
18-21: Ensure apify app prop cannot be overridden by base props.
Place apify last so it wins if present in others.props (even though adjustPropDefinitions should drop it).props: { - apify: app, - ...props, + ...props, + apify: app, },components/apify_oauth/actions/get-dataset-items/get-dataset-items.mjs (1)
18-21: Same apify prop ordering nit.
Put apify last for defensive override.props: { - apify: app, - ...props, + ...props, + apify: app, },components/apify_oauth/sources/new-finished-task-run-instant/new-finished-task-run-instant.mjs (1)
1-22: Reduce duplication with a tiny wrapper helperMany files repeat the same wrapper boilerplate. Consider centralizing it.
Apply:
- import app from "../../apify_oauth.app.mjs"; - import common from "@pipedream/apify/sources/new-finished-task-run-instant/new-finished-task-run-instant.mjs"; - - import { adjustPropDefinitions } from "../../common/utils.mjs"; - - const { name, description, type, ...others } = common; - const props = adjustPropDefinitions(others.props, app); - - export default { - ...others, - key: "apify_oauth-new-finished-task-run-instant", - version: "0.0.1", - name, - description, - type, - props: { - apify: app, - ...props, - }, - }; +import app from "../../apify_oauth.app.mjs"; +import common from "@pipedream/apify/sources/new-finished-task-run-instant/new-finished-task-run-instant.mjs"; +import wrap from "../../common/wrap.mjs"; + +export default wrap(common, "apify_oauth-new-finished-task-run-instant", app, "0.0.1");New file (supporting util):
// components/apify_oauth/common/wrap.mjs import { adjustPropDefinitions } from "./utils.mjs"; export default function wrap(common, key, app, version = "0.0.1") { const { name, description, type, ...others } = common; const props = adjustPropDefinitions(others.props ?? {}, app); return { ...others, key, version, name, description, type, props: { apify: app, ...props, }, }; }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (10)
components/apify_oauth/actions/get-dataset-items/get-dataset-items.mjs(1 hunks)components/apify_oauth/actions/run-actor/run-actor.mjs(1 hunks)components/apify_oauth/actions/run-task-synchronously/run-task-synchronously.mjs(1 hunks)components/apify_oauth/actions/scrape-single-url/scrape-single-url.mjs(1 hunks)components/apify_oauth/actions/set-key-value-store-record/set-key-value-store-record.mjs(1 hunks)components/apify_oauth/apify_oauth.app.mjs(1 hunks)components/apify_oauth/common/utils.mjs(1 hunks)components/apify_oauth/package.json(2 hunks)components/apify_oauth/sources/new-finished-actor-run-instant/new-finished-actor-run-instant.mjs(1 hunks)components/apify_oauth/sources/new-finished-task-run-instant/new-finished-task-run-instant.mjs(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (8)
components/apify_oauth/actions/get-dataset-items/get-dataset-items.mjs (1)
components/apify_oauth/common/utils.mjs (1)
adjustPropDefinitions(1-40)
components/apify_oauth/sources/new-finished-task-run-instant/new-finished-task-run-instant.mjs (1)
components/apify_oauth/common/utils.mjs (1)
adjustPropDefinitions(1-40)
components/apify_oauth/actions/scrape-single-url/scrape-single-url.mjs (1)
components/apify_oauth/common/utils.mjs (1)
adjustPropDefinitions(1-40)
components/apify_oauth/common/utils.mjs (8)
components/apify_oauth/actions/get-dataset-items/get-dataset-items.mjs (1)
props(9-9)components/apify_oauth/actions/run-actor/run-actor.mjs (1)
props(9-9)components/apify_oauth/actions/run-task-synchronously/run-task-synchronously.mjs (1)
props(9-9)components/apify_oauth/actions/scrape-single-url/scrape-single-url.mjs (1)
props(9-9)components/apify_oauth/actions/set-key-value-store-record/set-key-value-store-record.mjs (1)
props(9-9)components/apify_oauth/sources/new-finished-actor-run-instant/new-finished-actor-run-instant.mjs (1)
props(9-9)components/apify_oauth/sources/new-finished-task-run-instant/new-finished-task-run-instant.mjs (1)
props(9-9)components/monday_oauth/common/utils.mjs (1)
adjustPropDefinitions(1-40)
components/apify_oauth/actions/run-actor/run-actor.mjs (1)
components/apify_oauth/common/utils.mjs (1)
adjustPropDefinitions(1-40)
components/apify_oauth/actions/set-key-value-store-record/set-key-value-store-record.mjs (1)
components/apify_oauth/common/utils.mjs (1)
adjustPropDefinitions(1-40)
components/apify_oauth/actions/run-task-synchronously/run-task-synchronously.mjs (1)
components/apify_oauth/common/utils.mjs (1)
adjustPropDefinitions(1-40)
components/apify_oauth/sources/new-finished-actor-run-instant/new-finished-actor-run-instant.mjs (1)
components/apify_oauth/common/utils.mjs (1)
adjustPropDefinitions(1-40)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: Lint Code Base
- GitHub Check: Publish TypeScript components
- GitHub Check: Verify TypeScript components
- GitHub Check: pnpm publish
🔇 Additional comments (12)
components/apify_oauth/package.json (2)
3-3: Version bump looks good.
Matches a minor feature addition (new OAuth wrappers).
15-17: No action required: @pipedream/apify@^0.2.2 exports verified
The published tarball for version 0.2.2 includes the action modules you import in your wrappers:
package/actions/run-actor/run-actor.mjspackage/actions/get-dataset-items/get-dataset-items.mjsAll required export paths are present.
components/apify_oauth/common/utils.mjs (1)
1-40: Utility mirrors prior implementation and reads clean.
Logic for replacing the propDefinition’s first arg and dropping type==="app" props is sound.components/apify_oauth/apify_oauth.app.mjs (1)
1-19: Solid reuse of common app surface with OAuth headers.
Spreading common.propDefinitions/methods and centralizing headers is a good approach.components/apify_oauth/actions/run-actor/run-actor.mjs (1)
1-17: Wrapper structure is correct.
Name/description/type passthrough and others spread look good.components/apify_oauth/actions/get-dataset-items/get-dataset-items.mjs (1)
1-17: Consistent wrapper pattern.
Mirrors run-actor; good reuse of adjustPropDefinitions.components/apify_oauth/sources/new-finished-task-run-instant/new-finished-task-run-instant.mjs (2)
11-22: Wrapper pattern looks correct and safe to mergePropDefinitions are adjusted to the OAuth app, base fields are preserved via spread, and apify is injected correctly. Order of spreads ensures overrides work as intended.
13-14: Please manually verify OAuth component key and version alignmentIt wasn’t possible to confirm uniqueness and version consistency automatically. Before merging, please ensure:
- The
key: "apify_oauth-new-finished-task-run-instant"value does not appear in any othercomponents/apify_oauth/**/*.mjsfile.- The
version: "0.0.1"matches the versioning used by your existing OAuth wrappers (e.g. bump together or reset as needed).You can run these commands locally to inspect:
# List any duplicate keys rg --glob 'components/apify_oauth/**/*.mjs' -o "key: ['\"][^'\"]+['\"]" \ | sed -E "s/key: ['\"]([^'\"]+)['\"]/\\1/" \ | sort \ | uniq -d # Show all version values and their counts rg --glob 'components/apify_oauth/**/*.mjs' -o "version: ['\"][^'\"]+['\"]" \ | sed -E "s/version: ['\"]([^'\"]+)['\"]/\\1/" \ | sort \ | uniq -ccomponents/apify_oauth/actions/set-key-value-store-record/set-key-value-store-record.mjs (1)
11-22: Wrapper wiring looks goodProps are properly adjusted and the OAuth app is injected under apify; base action fields are preserved.
components/apify_oauth/actions/run-task-synchronously/run-task-synchronously.mjs (1)
11-22: LGTM on the OAuth adaptationSpread order, adjusted propDefinitions, and explicit apify app prop are all correct.
components/apify_oauth/sources/new-finished-actor-run-instant/new-finished-actor-run-instant.mjs (1)
11-22: Source wrapper looks correctCorrectly rebinds propDefinitions to OAuth app and overrides key/version cleanly.
components/apify_oauth/actions/scrape-single-url/scrape-single-url.mjs (1)
11-22: Action wrapper is properly configuredAll fields and props are adapted as expected; no issues spotted.
luancazarine
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @michelle0927, LGTM! Ready for QA!
|
/approve |
Resolves #18167
Summary by CodeRabbit
New Features
Chores